package com.zongheshili2.controller;

import com.zongheshili2.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Controller
public class StudentController {
    @GetMapping("/student")
    public String student(Student student, Model model){
        List<Student> students= Arrays.asList(
                new Student[]{
                    new Student(1, "张三","女",20, "计科1班"),
                    new Student(2, "李四","男",21, "计科2班"),
                    new Student(3, "王五","男",18, "计科3班")
                }
        );
        model.addAttribute("students",students);
        return "students";
    }
}
